import { ARCGIS } from "./arcgis";

import { LAYER_IDS } from "./layerId";
import {
    bridgeTemplate,
    communityTemplate, householdTemplate,
    outletTemplate,
    pumpTemplate,
    roadTemplate,
    wellTemplate,
    pipeTemplate
} from "./arcgisTemplate";


/**
 * type
 * 0 - 纯FeatureLayer
 * 1 - FeatureLayer + 管线[流向]DynamicLayer
 * 2 - FeatureLayer + 水位DynamicLayer
 * 3 - 纯GraphicLayer
 */

export var layerTree = [
    {
        id: '1',
        label: '道路',
        type: 0,
        serviceNos: [5],
        serviceUrl: [ARCGIS.gwss5Url],
        // layerIds: ['GWSS_DL_5'],
        layerIds: [ LAYER_IDS.FEATURE_GWSS_DL ],
        queryServiceNos: [9],
        queryUrl: ARCGIS.queryUrl,
        templates: [
            {
                title: '道路详情',
                content: roadTemplate
            },
        ]
    },
    {
        id: '2',
        label: '桥梁',
        type: 0,
        serviceNos: [6],
        serviceUrl: [ARCGIS.gwss6Url],
        // layerIds: ['GWSS_QL_6'],
        layerIds: [ LAYER_IDS.FEATURE_GWSS_QL ],
        queryServiceNos: [15],
        queryUrl: ARCGIS.queryUrl,
        templates: [
            {
                title: '桥梁详情',
                content: bridgeTemplate
            },
        ],
    },
    {
        id: '3',
        label: '小区',
        type: 0,
        serviceNos: [7],
        serviceUrl: [ARCGIS.gwss7Url],
        layerIds: [ LAYER_IDS.FEATURE_GWSS_XQ ],
        queryServiceNos: [14],
        queryUrl: ARCGIS.queryUrl,
        templates: [
            {
                title: '小区详情',
                content: communityTemplate,
            },
        ],
    },
    {
        id: '4',
        label: '泵站',
        type: 0,
        serviceNos: [4],
        serviceUrl: [ARCGIS.gwss4Url],
        layerIds: [ LAYER_IDS.FEATURE_GWSS_BZ ],
        queryServiceNos: [4],
        queryUrl: ARCGIS.queryUrl,
        templates: [
            {
                title: '泵站详情',
                content: pumpTemplate,
            },
        ],
    },
    {
        id: '5',
        label: '标识牌',
        disabled: true
    },
    {
        id: '6',
        label: '管网',
        children: [
            {
                id: '6-1',
                label: '检查井',
                type: 0,
                serviceNos: [0, 1, 2, 3],
                serviceUrl: [ARCGIS.ccgw0Url, ARCGIS.ccgw1Url, ARCGIS.ccgw2Url, ARCGIS.ccgw3Url],
                // layerIds: [
                //     'CCGW_YSD_0',
                //     'CCGW_WSD_1',
                //     'CCGW_YWHLD_2',
                //     'CCGW_JWD_3',
                // ],
                layerIds: [
                    LAYER_IDS.FEATURE_CCGW_YSD,
                    LAYER_IDS.FEATURE_CCGW_WSD,
                    LAYER_IDS.FEATURE_CCGW_YWHLD,
                    LAYER_IDS.FEATURE_CCGW_JWD
                ],
                queryServiceNos: [7, 6, 5, 8],
                queryUrl: ARCGIS.queryUrl,
                templates: [
                    {
                        title: '雨水井详情',
                        content: wellTemplate,
                    },
                    {
                        title: '污水井详情',
                        content: wellTemplate,
                    },
                    {
                        title: '雨污合流井详情',
                        content: wellTemplate,
                    },
                    {
                        title: '截污井详情',
                        content: wellTemplate,
                    },
                ],
            },
            {
                id: '6-2',
                label: '污水管',
                type: 1,
                // serviceNos: [9, 5],
                serviceNos: [5],
                serviceUrl: [ARCGIS.ccgw5Url],
                dynamicNos: [1, 5],
                // layerIds: ['CCGW_WSX_5'],
                layerIds: [ LAYER_IDS.FEATURE_CCGW_WSX ],
                queryServiceNos: [12],
                queryUrl: ARCGIS.queryUrl,
                templates: [
                    {
                        title: '污水管详情',
                        content: pipeTemplate
                    }
                ]
            },
            {
                id: '6-3',
                label: '雨水管',
                type: 1,
                // serviceNos: [8, 4],
                serviceNos: [4],
                serviceUrl: [ARCGIS.ccgw4Url],
                dynamicNos: [0, 4],
                // layerIds: ['CCGW_YSX_4'],
                layerIds: [ LAYER_IDS.FEATURE_CCGW_YSX ],
                queryServiceNos: [10],
                queryUrl: ARCGIS.queryUrl,
                templates: [
                    {
                        title: '雨水管详情',
                        content: pipeTemplate
                    }
                ]
            },
            {
                id: '6-4',
                label: '合水管',
                type: 1,
                // serviceNos: [10, 6],
                serviceNos: [6],
                serviceUrl: [ARCGIS.ccgw6Url],
                dynamicNos: [2, 6],
                // layerIds: ['CCGW_YWHLX_6'],
                layerIds: [ LAYER_IDS.FEATURE_CCGW_YWHLX ],
                queryServiceNos: [11],
                queryUrl: ARCGIS.queryUrl,
                templates: [
                    {
                        title: '合水管详情',
                        content: pipeTemplate
                    }
                ]
            },
            {
                id: '6-5',
                label: '截污管',
                type: 1,
                // serviceNos: [11, 7],
                serviceNos: [7],
                serviceUrl: [ARCGIS.ccgw7Url],
                dynamicNos: [3, 7],
                // layerIds: ['CCGW_JWX_7'],
                layerIds: [ LAYER_IDS.FEATURE_CCGW_JWX ],
                queryServiceNos: [12],
                queryUrl: ARCGIS.queryUrl,
                templates: [
                    {
                        title: '截污管详情',
                        content: pipeTemplate
                    }
                ]
            },
            {
                id: '6-6',
                label: '管网疏通范围',
                type: 0,
                serviceNos: [1],
                serviceUrl: [ARCGIS.areaMap1Url],
                // layerIds: ['AREA_MAP_GWSTFW']
                layerIds: [ LAYER_IDS.FEATURE_AREA_MAP_GWSTFW ]
            },
        ],
    },
    {
        id: '7',
        label: '排水监控',
        children: [
            {
                id: '7-1',
                label: '物联网监控',
                type: 2,
                serviceNos: [1],
                serviceUrl: [ARCGIS.gwss1Url],
                // layerIds: ['GWSS_WLWJK_1'],
                layerIds: [ LAYER_IDS.FEATURE_GWSS_WLWJK ],
                queryServiceNos: [1],
                queryUrl: ARCGIS.queryUrl
            },
            {
                id: '7-2',
                label: '易淹易涝点',
                type: 0,
                serviceNos: [0],
                serviceUrl: [ARCGIS.gwss0Url],
                // layerIds: ['GWSS_YYYLD_0'],
                layerIds: [ LAYER_IDS.FEATURE_GWSS_YYYLD ],
                queryServiceNos: [0],
                queryUrl: ARCGIS.queryUrl
            },
            {
                id: '7-3',
                label: '排口',
                type: 0,
                serviceNos: [3],
                serviceUrl: [ARCGIS.gwss3Url],
                // layerIds: ['GWSS_PK_3'],
                layerIds: [ LAYER_IDS.FEATURE_GWSS_PK ],
                queryServiceNos: [3],
                queryUrl: ARCGIS.queryUrl,
                templates: [
                    {
                        title: '排口详情',
                        content: outletTemplate,
                    },
                ],
            },
            {
                id: '7-4',
                label: '排水户',
                type: 0,
                serviceNos: [2],
                serviceUrl: [ARCGIS.gwss2Url],
                // layerIds: ['GWSS_PSH_2'],
                layerIds: [ LAYER_IDS.FEATURE_GWSS_PSH ],
                queryServiceNos: [2],
                queryUrl: ARCGIS.queryUrl,
                templates: [
                    {
                        title: '排水户详情',
                        content: householdTemplate,
                    },
                ],
            },
        ],
    },
    {
        id: '8',
        label: '工单',
        children: [
            {
                id: '8-1',
                label: '待派发',
                type: 3,
                // layerIds: ['GRAPHIC_DPF']
                layerIds: [ LAYER_IDS.GRAPHIC_ORDER_DPF ]
            },
            {
                id: '8-2',
                label: '实施中',
                type: 3,
                // layerIds: ['GRAPHIC_SSZ']
                layerIds: [ LAYER_IDS.GRAPHIC_ORDER_SSZ ]
            },
            {
                id: '8-3',
                label: '维修已完成',
                type: 3,
                // layerIds: ['GRAPHIC_WXYWC']
                layerIds: [ LAYER_IDS.GRAPHIC_ORDER_WXYWC ]
            },
            {
                id: '8-4',
                label: '返工处理中',
                type: 3,
                // layerIds: ['GRAPHIC_FGCLZ']
                layerIds: [ LAYER_IDS.GRAPHIC_ORDER_FGCLZ ]
            },
        ],
    },
    {
        id: '9',
        type: 0,
        label: '动态更新',
        serviceNos: [0],
        serviceUrl: [ARCGIS.areaMap0Url],
        // layerIds: ['AREA_MAP_DTGX']
        layerIds: [ LAYER_IDS.FEATURE_AREA_MAP_DTGX ]
    }
]